<!-- 我的活动-活动详情 -->
<template>
	<view v-if="Object.keys(detailInfo).length>0" class="my-course-detail page-background">
		<view class="status-area">
			<view class="status">
				{{matchStatus}}
			</view>
			<view class="tips">
				{{matchTips}}
			</view>
		</view>
		<view class="ball_item item-box">
			<view class="player-item">
				<view class="left">
					<image class="icon" :src="detailInfo.playerIcon" mode=""></image>
					<image v-if="detailInfo.sex=='1'" class="icon-sex" :src="'@/static/images/mine/icon-sex-boy.png'|addBaseImgUrl" mode=""></image>
					<image v-else class="icon-sex"  :src="'@/static/images/mine/icon-sex-gril.png'|addBaseImgUrl" mode=""></image>
				</view>
				<view class="right">
					<view class="title-row flex-box">
						<text class="player-name">{{detailInfo.relName}}</text>
						<view class="lit-tag">
							{{detailInfo.typeValue}}
						</view>
						<view  :class="detailInfo.sex=='1'?'lit-tag icon_m':'lit-tag icon_w'">
							级别L{{detailInfo.skillLevel}}
						</view>
					</view>
					<view class="content-row">
						手机：{{detailInfo.emergencyContact||''}}
					</view>
					<view class="content-row">
						出生日期：{{detailInfo.birthday}}
					</view>
				</view>
			</view>
			<view class="levelTip">
				<view class="levelTip_left">
					将以俱乐部定义的级别，作为您的报名级别，如有问题请联系俱乐部
				</view>
				<view :class="detailInfo.sex=='1'? 'levelTip_right_b':'levelTip_right_r'">
					<view :class="detailInfo.sex=='1'? 'level_m':'level_w'">
					</view>
					<view class="level_txt">
						级别L{{detailInfo.playerSkillLevel}}
					</view>
				</view>
			</view>
		</view>
		<xjx-com-item :item="detailInfo" :styletype="'two'" @todetail="toDetail" :styleType="2" :classoract="'activity'"/>
		<!-- <view class="course-item item-box">
			<view @click="to('/mainProcess/club/detail/detail?id='+detailInfo.clubId)" class="top-row flex-box">
				<view class="left flex-box">
					<view class="club-name">
						{{detailInfo.clubName}}
					</view>
					<van-icon name="arrow" size="15px" color="#CCCCCC" />
				</view>
			</view>
			<view @click="to('/activity/detail/detail?id='+detailInfo.actId)" class="course-info flex-box">
				<view class="left">
					<image :src="detailInfo.actImgUrl" mode=""></image>
				</view>
				<view class="right">
					<view class="title-price flex-box">
						<view class="course-title line-clamp-2">
							{{detailInfo.actName}}
						</view>
						<view v-if="detailInfo.amount" class="course-price">
							￥<text>{{detailInfo.amount|floorTwo}}</text>
						</view>
					</view>
					<view class="tags flex-box">
						<view v-if="detailInfo.actTypeValue" class="lit-tag">
							{{detailInfo.actTypeValue}}
						</view>
						<view v-if="detailInfo.actLevelEnd&&detailInfo.actLevelStart" class="lit-tag">
							{{'L'+detailInfo.actLevelStart+'-L'+detailInfo.actLevelEnd}}
						</view>
					</view>
				</view>
			</view>
		</view> -->
		<!-- 赛事活动展示 -->
		<view v-if="detailInfo.actType==2&&detailInfo.eventSystemType&&detailInfo.status=='0'" class="footer-view">
			<view v-if="detailInfo.eventSystemType=='10'" :class="detailInfo.eventTeamStatus>0?'team blue':'team'" @click="to('/activity/teamList/teamList?actId='+detailInfo.actId + '&teamStatus=' + detailInfo.eventTeamStatus + '&groupStatus=' + detailInfo.eventGroupsStatus+'&clubName='+detailInfo.clubName,detailInfo.eventTeamStatus>0)">
				<view class="top">
					1
				</view>
				<view class="middle">
					组队
				</view>
				<view class="bottom">
					{{detailInfo.eventTeamStatus>0?'已完成':'准备中'}}
				</view>
			</view>
			<view v-if="detailInfo.eventSystemType=='10'" :class="detailInfo.eventGroupsStatus>0?'group blue':'group'" @click="to('/activity/teamList/teamList?actId='+detailInfo.actId + '&teamStatus=' + detailInfo.eventTeamStatus + '&groupStatus=' + detailInfo.eventGroupsStatus+'&clubName='+detailInfo.clubName,detailInfo.eventGroupsStatus>0)">
				<view class="top">
					2
				</view>
				<view class="middle">
					分组
				</view>
				<view class="bottom">
					{{detailInfo.eventGroupsStatus>0?'已完成':'准备中'}}
				</view>
			</view>
			<view v-if="detailInfo.eventSystemType=='20'||detailInfo.eventSystemType=='30'" :class="detailInfo.eventTeamStatus>0?'team-only blue':'team-only'" @click="to('/activity/teamList/teamList?actId='+detailInfo.actId + '&teamStatus=' + detailInfo.eventTeamStatus + '&groupStatus=' + detailInfo.eventGroupsStatus+'&clubName='+detailInfo.clubName,detailInfo.eventTeamStatus>0)">
				<view class="middle">
					分队
				</view>
				<view class="bottom">
					{{detailInfo.eventTeamStatus>0?'已完成':'准备中'}}
				</view>
			</view>
			<view :class="bfFlag?'score blue':'score'" @click="to('/activity/matchInfo/matchDetail?actId='+detailInfo.actId,bfFlag)">
				<view class="">
					比分
				</view>
				<view class="">
					排名
				</view>
			</view>
		</view>
		<!-- 弹出框 -->
		<van-dialog id="van-dialog" confirm-button-color="#2E87FF" cancel-button-color="#2E87FF" />
	</view>
</template>

<script>
	import { mapState, mapGetters, mapMutations } from 'vuex'
	import Dialog from '@/wxcomponents/vant/dist/dialog/dialog';
	export default {
		data() {
			return {
				detailInfo: {}
			};
		},
		onLoad(data) {
			this.id = data.id || ''
		},
		onShow(){
			this.init()
		},
		computed: {
			...mapState(['userInfo','accessToken','sportEventId']),
			bfFlag(){
				if((this.detailInfo.eventSystemType==10&&this.detailInfo.eventGroupsStatus>0)||(this.detailInfo.eventTeamStatus>0&&this.detailInfo.eventSystemType!=10)){
					return true
				}
				return false
			},
			matchStatus(){
				let item = this.detailInfo
				if(item.actType==2&&item.eventSystemType&&item.isRefund=='0'){// 未发生退款的赛事活动
					return item.eventStatusValue
				}else{
					if(item.actStatus=='1'){
						return item.actStatusValue
					}else if(item.orderStatus=='4'||(item.orderStatus=='6'&&item.isRefund=='1')){
						return item.orderStatusName||''
					}else{
						return item.actStateStr
					}
				}
			},
			matchTips(){
				return ''
				if(this.detailInfo.actState==0){
					return '请耐心等待哟～'
				}else{
					return ''
				}
			}
		},
		methods:{
			...mapMutations(['setStateAttr']),
			async init(){
				const param = {
					'ACCESS-TOKEN': this.accessToken
				}
				const res = await this.$api.queryActEnterDetail(param, this.id)
				if(res&&res.code==200){
					this.detailInfo = res.data
				}
			},
			to(url,boo) {
				if(boo){
					this.setStateAttr([
					  {
					    key: 'sportEventId',
					    val: this.detailInfo.eventSystemType
					  }
					])
					uni.navigateTo({
						url: url
					})
				}
			},
			toDetail(){
				uni.navigateTo({
					url: '/activity/detail/detail?id='+this.detailInfo.actId
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.my-course-detail{
		min-height: 100vh;
		padding-bottom: 130rpx;
		.status-area{
			position: relative;
			height: 130rpx;
			background-color: $public-color-blue1;
			padding: 20rpx;
			.status{
				color: white;
				font-size: 36rpx;
			}
			.tips{
				font-size: 26rpx;
				color: #8CBCFC;
			}
			.appoint-numbers{
				position: absolute;
				right: 30rpx;
				top: 50%;
				transform: translateY(-50%);
				color: white;
				font-size: 24rpx;
				.ready-number{
					font-size: 60rpx;
				}
				.center-line{
					margin: 0 10rpx;
				}
			}
		}
		.ball_item{
			overflow: hidden;
		}
		.player-item{
			padding: 30rpx 20rpx;
			display: flex;
			align-items: flex-start;
			justify-content: flex-start;
			.left{
				width: 110rpx;
				height: 110rpx;
				position: relative;
				margin-right: 20rpx;
				background-color: #F2F2F2;
				border-radius: 50%;
				image{
					width: 100%;
					height: 100%;
					vertical-align: middle;
				}
				.icon{
					border-radius: 50%;
				}
				.icon-sex{
					position: absolute;
					right: 0;
					top: 0;
					width: 30rpx;
					height: 30rpx;
				}
			}
			.right{
				.title-row{
					justify-content: flex-start;
					align-items: center;
					.player-name{
						font-size: 34rpx;
						margin-right: 10rpx;
					}
				}
				.content-row{
					font-size: 26rpx;
					color: $text-color-grey;
					margin-top: 5rpx;
				}
				.icon_m{
					background-color:transparent!important;
					border:1px solid #C8DBFF;
					color:#2E87FF!important;
				}
				.icon_w{
					background-color:transparent!important;
					border:1px solid #FFC8C3;
					color:#E14806;
				}
			}
		}
		.levelTip{
			background: #EEF5FE;
			display: flex;
			justify-content: space-between;
			padding: 6rpx 21rpx;
			align-items: center;
			.levelTip_left{
				width: 70%;
				font-size: 22rpx;
				color: #999999;
			}
			.levelTip_right_r{
				border: 2rpx solid #FFC8C3;
				border-radius: 5rpx;
				display: flex;
				align-items: center;
				padding:0rpx 7rpx;
				.level_txt{
					font-size: 22rpx;
					color: #E14806;
				}
			}
			.levelTip_right_b{
				border: 2rpx solid #C8DBFF;
				border-radius: 5rpx;
				display: flex;
				align-items: center;
				padding:0rpx 7rpx;
				.level_txt{
					font-size: 22rpx;
					color: #2E87FF;
				}
			}
		}
		.course-item{
			min-height: 280rpx;
			box-sizing: border-box;
			padding: 30rpx 20rpx;
			.top-row{
				height: 30rpx;
				.left{
					.club-name{
						font-size: 30rpx;
						line-height: 30rpx;
						margin-right: 10rpx;
					}
				}
				.right{
					color: #FDB42E;
					font-size: 26rpx;
					line-height: 30rpx;
				}
			}
			.course-info{
				height: 160rpx;
				margin-top: 30rpx;
				align-items: stretch;
				.left{
					width: 160rpx;
					height: 160rpx;
					margin-right: 20rpx;
					flex: 0 0 auto;
					background-color: #F2F2F2;
					border-radius: 15rpx;
					image{
						width: 100%;
						height: 100%;
						vertical-align: middle;
						border-radius: 15rpx;
					}
				}
				.right{
					flex: 1 0 auto;
					display: flex;
					flex-flow: column;
					justify-content: space-between;
					.title-price{
						align-items: flex-start;
						.course-title{
							line-height: 38rpx;
							max-width: 340rpx;
						}
						.course-price{
							font-size: 24rpx;
							line-height: 38rpx;
							text{
								font-size: 30rpx;
							}
						}
					}
					.venue{
						font-size: 26rpx;
						color: $text-color-grey;
						text-overflow: ellipsis;
						white-space: nowrap;
						overflow: hidden;
					}
					.tags{
						justify-content: flex-start;
					}
				}
			}
			.btn-row{
				margin-top: 30rpx;
				display: flex;
				justify-content: flex-end;
				.btn-appoint{
					width: 245rpx;
					height: 72rpx;
					background: rgba(46, 135, 255, 0);
					border: 2rpx solid $public-color-blue1;
					color: $public-color-blue1;
					line-height: 68rpx;
					text-align: center;
					border-radius: 36px;
				}
			}
		}
		
		.appoint-item{
			padding: 20rpx 20rpx 0;
			.label{
				font-size: 34rpx;
			}
			.appoint-list{
				.list-item{
					padding: 20rpx 0 30rpx;
					.main-info{
						align-items: center;
						.info-left{
							width: 122rpx;
							height: 122rpx;
							position: relative;
							padding: 2rpx;
							margin-right: 15rpx;
							border: 4rpx solid $public-color-yellow1;
							border-radius: 50%;
							.coach-icon{
								width: 110rpx;
								height: 110rpx;
								vertical-align: middle;
								border-radius: 50%;
							}
							.gold-icon{
								width: 48rpx;
								height: 48rpx;
								position: absolute;
								right: -10rpx;
								top: -10rpx;
							}
						}
						.info-right{
							flex: 1 0 auto;
							.title-row{
								align-items: center;
								.coach-name{
									font-size: 34rpx;
								}
								.appoint-status{
									color: $public-color-yellow1;
									font-size: 26rpx;
								}
							}
							.content-row{
								font-size: 26rpx;
								color: $text-color-grey;
							}
						}
					}
					.btn-row{
						margin-top: 25rpx;
						justify-content: flex-end;
						.btn{
							margin-left: 20rpx;
							width: 245rpx;
							height: 72rpx;
							line-height: 68rpx;
							color: $text-color-blue1;
							border: 2rpx solid $public-color-blue1;
							text-align: center;
							border-radius: 36rpx;
							&.cancel{
								color: $text-color-grey;
								border-color: $text-color-grey;
							}
						}
					}
				}
			}
		}
		
		.footer-view{
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			background-color: #FFF;
			height: 160rpx;
			&>view{
				position: absolute;
			}
			.team,.group{
				position: absolute;
				display: flex;
				flex-flow: column;
				align-items: center;
				justify-content: flex-start;
				width: 100rpx;
				top: -18rpx;
				overflow: hidden;
				// height: 130rpx;
				&.blue{
					.top{
						background-color: $bg-color-blue1;
					}
					.middle{
						color: $bg-color-blue1;
					}
					.bottom{
						background-color: $bg-color-blue1;
						color: #FFF;
					}
				}
				.top{
					width: 36rpx;
					height: 36rpx;
					text-align: center;
					line-height: 36rpx;
					border-radius: 50%;
					font-size: 32rpx;
					color: #FEFEFF;
					background-color: #CCCCCC;
				}
				.middle{
					color: #CCCCCC;
					font-weight: bold;
				}
				.bottom{
					border-radius: 36rpx;
					height: 36rpx;
					line-height: 36rpx;
					width: 100%;
					text-align: center;
					color: #A5A5A5;
					background-color: #F2F2F2;
					font-size: 24rpx;
				}
			}
			.team-only{
				position: absolute;
				display: flex;
				flex-flow: column;
				align-items: center;
				justify-content: flex-start;
				width: 100rpx;
				top: 0;
				left: 50%;
				transform: translateX(-50%);
				padding-top: 18rpx;
				overflow: hidden;
				// height: 130rpx;
				&.blue{
					.middle{
						color: $bg-color-blue1;
					}
					.bottom{
						background-color: $bg-color-blue1;
						color: #FFF;
					}
				}
				.middle{
					color: #CCCCCC;
					font-weight: bold;
				}
				.bottom{
					border-radius: 36rpx;
					height: 36rpx;
					line-height: 36rpx;
					width: 100%;
					text-align: center;
					color: #A5A5A5;
					background-color: #F2F2F2;
					font-size: 24rpx;
				}
			}
			.team{
				left: 40rpx;
				
			}
			.group{
				left: 50%;
				transform: translateX(-50%);
			}
			.score{
				right: 30rpx;
				top: -63rpx;
				display: flex;
				flex-flow: column;
				align-items: center;
				justify-content: center;
				background-color: #CCCCCC;
				box-shadow: 0px 10px 35px 0px rgba(153, 153, 153, 0.5);
				width: 126rpx;
				height: 126rpx;
				border-radius: 50%;
				font-weight: bolder;
				&.blue{
					background: $bg-color-blue1;
					box-shadow: 0px 10px 35px 0px rgba(46, 135, 255, 0.5);
				}
				view{
					line-height: 36rpx;
					color: #FFF;
				}
			}
		}
	}
</style>
